<html>
<body>
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.8.18/themes/base/jquery-ui.css" type="text/css" media="all" />
    <script src="https://code.jquery.com/jquery-git2.min.js" type="text/javascript"></script>
    <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.min.js" type="text/javascript"></script>
    <script>
        var list_site = {
            'localhost': "localhost:8080",
            '192.168.10.53': "192.168.10.53:8080",
            'google': "google-all-tasks.googlecode.com"
        };

        function handleClientLoad() {

            var domain = (document.domain.indexOf("google") != -1) ? "google" : document.domain;
            var site = list_site[domain];

            loadjscssfile("https://" + site + "/git/google-all-tasks.css");
            loadjscssfile("https://" + site + "/git/google-all-tasks.js");
            loadjscssfile("https://" + site + "/git/task.js");
            loadjscssfile("https://" + site + "/git/tasklist.js");
            loadjscssfile("https://" + site + "/git/gat-utils.js");
            loadjscssfile("https://" + site + "/git/google-auth.js");
        }

        function loadjscssfile(filename) {
            console.log(filename);
            if(filename.search(/js$/)>0) {
                var fileref=document.createElement('script');
                fileref.setAttribute("type","text/javascript");
                fileref.setAttribute("src",filename);
            } else if(filename.search(/css$/)>0) {
                var fileref=document.createElement('link');
                fileref.setAttribute("rel","stylesheet");
                fileref.setAttribute("type","text/css");
                fileref.setAttribute("href",filename);
            }
            if(typeof fileref!="undefined")
                document.getElementsByTagName("head")[0].appendChild(fileref);
        }
    </script>
    <div id="content">
        <div id='datepicker'></div>
        <nav class="nav"><ul id="mylist" class="list"></nav>
        </div>
        <button id="authorize-button" style="visibility: hidden">Authorize</button>
        <script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
</body>
</html>
